#define  _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main() {
    int m, n;
    int arr[2000];
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n + m; i++) {
        scanf("%d", &arr[i]);
    }
    for (int i = 0; i < m + n; i++) {
        for (int j = 1; j < m + n - i; j++) {
            if (arr[j - 1] > arr[j]) {
                int temp;
                temp = arr[j];
                arr[j] = arr[j - 1];
                arr[j - 1] = temp;
            }
        }
    }
    for (int i = 0; i < m + n; i++) {
        printf("%d ", arr[i]);
    }
    return 0;
}